import React, { Component } from 'react';
import { PlusOutlined } from '@ant-design/icons';
import {
    Form,
    Input,
    Button,
    Radio,
    Select,
    Cascader,
    DatePicker,
    InputNumber,
    TreeSelect,
    Switch,
    Checkbox,
    Upload,
} from 'antd';
import service from '../../utils/service';
const { RangePicker } = DatePicker;
const { TextArea } = Input;
const sub = (values: any) => {
    console.log(values)
    service({
        url: 'http://localhost:3000/studentManagement',
        method: 'POST',
        data: {
            id: values.num,
            key: values.key,
            name: values.name,
            num: values.num,
            grand: values.grand,
            class: values.class,
            sex: values.sex,
            nation: values.nation,
            name1: values.name1,
            phone1: values.phone1
           
        },
    }).then(res => {
        console.log('1111');

    })
}

class addstu extends Component {
    render() {
        return (
            <>
                <Form
                    name="basic"
                    labelCol={{ span: 8 }}
                    wrapperCol={{ span: 16 }}
                    style={{ maxWidth: 600 }}
                    initialValues={{ remember: true }}
                    onFinish={sub}
                    autoComplete="off"
                >
                    <Form.Item label="学生姓名" name='name'>
                        <Input />
                    </Form.Item>
                    <Form.Item label="学籍号" name='num'>
                        <Input />
                    </Form.Item>

                    <Form.Item label="监护人姓名" name='name1'>
                        <Input />
                    </Form.Item>

                    <Form.Item label="监护人电话" name='phone1'>
                        <Input />
                    </Form.Item>
                    <Form.Item label="地址" name='address'>
                        <Input />
                    </Form.Item>
                    <Form.Item label="性别" name='sex'   >
                        <Select>
                            <Select.Option value="男" >男</Select.Option>
                            <Select.Option value="女" >女</Select.Option>
                        </Select>
                    </Form.Item>
                    <Form.Item label="民族" name='nation'   >
                        <Select>
                            <Select.Option value="汉族" >汉族</Select.Option>
                            <Select.Option value="回族" >回族</Select.Option>
                            <Select.Option value="蒙古族" >蒙古族</Select.Option>
                            <Select.Option value="壮族" >壮族</Select.Option>
                            <Select.Option value="满族" >满族</Select.Option>
                            <Select.Option value="维吾尔族" >维吾尔族</Select.Option>
                        </Select>
                    </Form.Item>
                    <Form.Item label="年级" name='grand'   >
                        <Select>
                            <Select.Option value="一年级" >一年级</Select.Option>
                            <Select.Option value="二年级" >二年级</Select.Option>
                            <Select.Option value="三年级" >三年级</Select.Option>
                            <Select.Option value="四年级" >四年级</Select.Option>
                            <Select.Option value="五年级" >五年级</Select.Option>
                            <Select.Option value="六年级" >六年级</Select.Option>
                        </Select>
                    </Form.Item>
                    <Form.Item label="班" name='class'   >
                        <Select>
                            <Select.Option value="一班" >一班</Select.Option>
                            <Select.Option value="二班" >二班</Select.Option>
                            <Select.Option value="三班" >三班</Select.Option>
                            <Select.Option value="四班" >四班</Select.Option>
                            <Select.Option value="五班" >五班</Select.Option>
                            <Select.Option value="六班" >六班</Select.Option>
                        </Select>
                    </Form.Item>
                    <Form.Item wrapperCol={{ offset: 8, span: 16 }}>
                        <Button type="primary" htmlType="submit">
                            添加
                        </Button>
                    </Form.Item>
                </Form>
            </>
        );
    }
}

export default addstu;